package com.zhouheng.kafkaconsumer.module.basedemo;

import com.zhouheng.kafkacommon.entity.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

@Service
public class consumer {

    @KafkaListener(topics = "str", group = "group_id")
    public void consume(String message) {
        System.out.println("Consumed Message: " + message);
    }


    @KafkaListener(topics = "json", group = "group_json",
            containerFactory = "userKafkaListenerFactory")
    public void consumeJson(User user) {
        System.out.println("Consumed JSON Message: " + user);
    }

}
